<template>
	<div class="zh-version-management">
		<nav-header></nav-header>
        <div>
            <el-radio-group v-model="sceneVal">
                <el-radio :label="0">k12</el-radio>
                <el-radio :label="1">高校</el-radio>
            </el-radio-group>
            <div class="demo-image__preview sceneImage">
                <el-image 
                    :src="sceneVal? '../../../static/image/colleges.png' : '../../../static/image/k12.png'" 
                    :preview-src-list="sceneVal? srcList2 : srcList1">
                </el-image>
            </div>
            <div>
                <el-button type="primary" @click="saveScene">保存</el-button>
            </div>
        </div>
	</div>
</template>

<script>
  	export default {
	    data() {
		    return {
                sceneVal: 0,
                srcList1: ['../../../static/image/k12.png'],
                srcList2: ['../../../static/image/colleges.png'],
		    };
	    },
	    created(){},
	    mounted(){
            this.getScene()
        },
	    methods: {
            getScene() {
                const success = res =>{
                    this.sceneVal = res.data - 1
                }
                this.$ajax.get('api/login/frontVersion', {func: {success}})
            },
	        saveScene() {
                const success = res =>{
                    this.$message.success(res.msg)
                    this.getScene()
                }
                const params = {
                    type: this.sceneVal+1
                }
                this.$ajax.put('api/login/frontVersion', params, {func: {success}})
            }
    	}
  	};
</script>
<style lang="scss">
	.zh-version-management{
        .sceneImage {
            width: 408px;
            height: 600px;
            margin: 30px 0;
            .el-image {
                width: 100%;
                height: 100%;
            }
        }
	}
</style>